#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#"""指定大小        pip install Pillow
from PIL import Image
import glob, os 

#图片批处理 
def timage(): 
    for files in glob.glob(r'D:\\\\1111\nursing2.png'):    
        filepath,filename = os.path.split(files) 
        filterame,exts = os.path.splitext(filename) 
        #输出路径 
        opfile = r'D:\\\\2222\\\\'
        #判断opfile是否存在，不存在则创建 
        if (os.path.isdir(opfile)==False): 
            os.mkdir(opfile) 
        im = Image.open(files) 
        w,h = im.size 
        #im_ss = im.resize((400,400)) 
        #im_ss = im.convert('P') 
        im_ss = im.resize((200, 200),Image.ANTIALIAS) 
        im_ss.save(opfile+filterame+'.png') 
        print(im_ss.mode)

if __name__=='__main__': 
    timage() 

    print('is  over')

#"""







